{include file="public/header"/}
</head>
<body>
<div class="layui-form">
    <div class="layui-fluid pd83">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-sm12">
            <div class="layui-card pcf30">
                <div class="layui-form-item">
                    <label class="layui-form-label"><b class="pcfts">*</b>会员等级</label>
                    <div class="layui-input-inline">
                    <select name="level_id" lay-verify="required">
                        <option value="">请选择会员等级</option>
                        {volist name="list" id="vo"}
                        <option value="{$vo.id}">{$vo.level_name}</option>
                        {/volist}
                    </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label"><b class="pcfts">*</b>手机号码</label>
                    <div class="layui-input-inline pcfcms_layui-input-inline">
                        <input type="text" name="mobile" class="layui-input" value="" lay-verify="required"/>
                    </div>
                </div>                
                <div class="layui-form-item">
                    <label class="layui-form-label"><b class="pcfts">*</b>用户密码</label>
                    <div class="layui-input-inline pcfcms_layui-input-inline">
                        <input type="text" name="password" class="layui-input" value="" lay-verify="required"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">用户余额</label>
                    <div class="layui-input-inline pcfcms_layui-input-inline">
                        <input type="text" name="price" class="layui-input" value=""/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">用户账号</label>
                    <div class="layui-input-inline pcfcms_layui-input-inline">
                        <input type="text" name="username" class="layui-input" value="" />
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">用户邮箱</label>
                    <div class="layui-input-inline pcfcms_layui-input-inline">
                        <input type="text" name="email" class="layui-input" value=""/>
                    </div>
                </div>   
                <div class="layui-form-item">
                    <label class="layui-form-label">真实姓名</label>
                    <div class="layui-input-inline pcfcms_layui-input-inline">
                        <input type="text" name="truename" class="layui-input" value=""/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">用户昵称</label>
                    <div class="layui-input-inline pcfcms_layui-input-inline">
                        <input type="text" name="nickname" class="layui-input" value=""/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">QQ号码</label>
                    <div class="layui-input-inline pcfcms_layui-input-inline">
                        <input type="text" name="qq" class="layui-input" value=""/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">备注</label>
                    <div class="layui-input-inline pcfcms_layui-input-inline">
                        <textarea name="remark" class="layui-textarea"></textarea>
                    </div>
                </div>
                <div class="pcfclear"></div>
            </div>
        </div>
    </div>
    </div>
    <div class="submit-info text-center">
        <button class="layui-btn" lay-submit lay-filter="formSubmit">确认提交</button>
        <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
    </div>  
</div>
{include file="public/footer"/}
<script>
    layui.use(['layer', 'form'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var form = layui.form;
        form.render();

        //监听提交
        form.on('submit(formSubmit)', function(data){
            layer.msg('正在处理请勿刷新页面', {icon: 16,shade: 0.01,time:3600000});
            $.ajax({
                type : 'post',
                url : "{:url('/users/add')}",
                data : data.field,
                dataType : 'json',
                success : function(res){
                    layer.closeAll();
                    if(res.status){
                        layer.msg(res.msg,{icon:1,time:1000},function(){
                            parent.window.location.href = res.url;
                        });
                    }else{
                        layer.msg(res.msg, {icon: 2, time: 1000});
                    }
                },
                error: function(e){
                    layer.closeAll();
                    layer.msg("未知错误，操作中断！", {icon: 2, time: 1000});
                }
            });
        });

    });
</script>
</body>
</html>